package com.nft.infrastructure.fisco.raw;

import org.fisco.bcos.sdk.abi.FunctionReturnDecoder;
import org.fisco.bcos.sdk.abi.TypeReference;
import org.fisco.bcos.sdk.abi.datatypes.Event;
import org.fisco.bcos.sdk.abi.datatypes.Function;
import org.fisco.bcos.sdk.abi.datatypes.Type;
import org.fisco.bcos.sdk.abi.datatypes.Utf8String;
import org.fisco.bcos.sdk.abi.datatypes.generated.Int256;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple1;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple2;
import org.fisco.bcos.sdk.client.Client;
import org.fisco.bcos.sdk.contract.Contract;
import org.fisco.bcos.sdk.crypto.CryptoSuite;
import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.eventsub.EventCallback;
import org.fisco.bcos.sdk.model.CryptoType;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.fisco.bcos.sdk.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.transaction.model.exception.ContractException;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

@SuppressWarnings("unchecked")
public class MapStorage extends Contract {
    public static final String[] BINARY_ARRAY = {"60806040523480156200001157600080fd5b506040805190810160405280600a81526020017f6d617053746f72616765000000000000000000000000000000000000000000008152506040805190810160405280600281526020017f69640000000000000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f6b657900000000000000000000000000000000000000000000000000000000008152506040805190810160405280600581526020017f76616c756500000000000000000000000000000000000000000000000000000081525060006110019050606060026040519080825280602002602001820160405280156200013257816020015b6200011e62000cdc565b815260200190600190039081620001145790505b5090506200015484620004d96401000000000262002bd1176401000000009004565b8160008151811015156200016457fe5b906020019060200201819052506200019083620004d96401000000000262002bd1176401000000009004565b816001815181101515620001a057fe5b906020019060200201819052508173ffffffffffffffffffffffffffffffffffffffff166356004b6a87876200024185620002246040805190810160405280600181526020017f2c00000000000000000000000000000000000000000000000000000000000000815250620004d96401000000000262002bd1176401000000009004565b620005096401000000000262002bff179091906401000000009004565b6040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016200027d939291906200100f565b602060405180830381600087803b1580156200029857600080fd5b505af1158015620002ad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250620002d3919081019062000fa7565b5060806040519081016040528087815260200186815260200185815260200160006040519080825280602002602001820160405280156200032957816020015b6060815260200190600190039081620003135790505b508152506000808201518160000190805190602001906200034c92919062000cf6565b5060208201518160010190805190602001906200036b92919062000cf6565b5060408201518160020190805190602001906200038a92919062000cf6565b506060820151816003019080519060200190620003a992919062000d7d565b50905050620003ca600085856200069b640100000000026401000000009004565b5050505050506040805190810160405280600281526020017f6964000000000000000000000000000000000000000000000000000000000000815250600490805190602001906200041d92919062000de4565b506040805190810160405280600381526020017f6b65790000000000000000000000000000000000000000000000000000000000815250600590805190602001906200046b92919062000de4565b50620004bb6040805190810160405280600581526020017f76616c75650000000000000000000000000000000000000000000000000000008152506200083c640100000000026401000000009004565b60069080519060200190620004d292919062000e6b565b50620010bd565b620004e362000ed2565b600060208301905060408051908101604052808451815260200182815250915050919050565b60606000825114156200052f576020604051908101604052806000815250905062000695565b60006001835103846000015102905060008090505b83518110156200057d5783818151811015156200055d57fe5b906020019060200201516000015182019150808060010191505062000544565b506060816040519080825280601f01601f191660200182016040528015620005b45781602001600182028038833980820191505090505b509050600060208201905060008090505b85518110156200068d5762000623828783815181101515620005e357fe5b906020019060200201516020015188848151811015156200060057fe5b9060200190602002015160000151620009b0640100000000026401000000009004565b85818151811015156200063257fe5b90602001906020020151600001518201915060018651038110156200067f57620006758288602001518960000151620009b0640100000000026401000000009004565b8660000151820191505b8080600101915050620005c5565b508193505050505b92915050565b82600301829080600181540180825580915050906001820390600052602060002001600090919290919091509080519060200190620006dc92919062000de4565b5050620006e862000ed2565b6200070782620004d96401000000000262002bd1176401000000009004565b90506200071362000ed2565b620007676040805190810160405280600181526020017f2c00000000000000000000000000000000000000000000000000000000000000815250620004d96401000000000262002bd1176401000000009004565b905060006001620007908385620009fd6401000000000262002d63179091906401000000009004565b01905060008090505b81811015620008335786600301620007e7620007cd858762000a986401000000000262002dda179091906401000000009004565b62000ac56401000000000262002df4176401000000009004565b90806001815401808255809150509060018203906000526020600020016000909192909190915090805190602001906200082392919062000de4565b5050808060010191505062000799565b50505050505050565b60606200084862000ed2565b6200086783620004d96401000000000262002bd1176401000000009004565b90506200087362000ed2565b620008c76040805190810160405280600181526020017f2c00000000000000000000000000000000000000000000000000000000000000815250620004d96401000000000262002bd1176401000000009004565b905060606001620008f08385620009fd6401000000000262002d63179091906401000000009004565b016040519080825280602002602001820160405280156200092657816020015b6060815260200190600190039081620009105790505b50905060008090505b8151811015620009a4576200097a62000960848662000a986401000000000262002dda179091906401000000009004565b62000ac56401000000000262002df4176401000000009004565b82828151811015156200098957fe5b9060200190602002018190525080806001019150506200092f565b50809350505050919050565b5b602081101515620009d85781518352602083019250602082019150602081039050620009b1565b60006001826020036101000a0390508019835116818551168181178652505050505050565b600080826000015162000a32856000015186602001518660000151876020015162000b39640100000000026401000000009004565b0190505b83600001518460200151018111151562000a91578180600101925050826000015162000a8885602001518303866000015103838660000151876020015162000b39640100000000026401000000009004565b01905062000a36565b5092915050565b62000aa262000ed2565b62000abe83838362000c29640100000000026401000000009004565b5092915050565b60608082600001516040519080825280601f01601f19166020018201604052801562000b005781602001600182028038833980820191505090505b509050600060208201905062000b2f8185602001518660000151620009b0640100000000026401000000009004565b8192505050919050565b6000808490506000868511151562000c195760208511151562000bcd57600060018660200360080260020a0319600102905060008186511690506000878a8a0103905060008386511690505b828114151562000bbe57818610151562000baa578a8a01965050505050505062000c21565b858060010196505083865116905062000b85565b85965050505050505062000c21565b60008585209050600091505b8588038211151562000c1757600086842090508082141562000c02578394505050505062000c21565b60018401935050818060010192505062000bd9565b505b868601925050505b949350505050565b62000c3362000ed2565b600062000c62856000015186602001518660000151876020015162000b39640100000000026401000000009004565b9050846020015183602001818152505084602001518103836000018181525050846000015185602001510181141562000ca657600085600001818152505062000cd1565b8360000151836000015101856000018181510391508181525050836000015181018560200181815250505b829150509392505050565b604080519081016040528060008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1062000d3957805160ff191683800117855562000d6a565b8280016001018555821562000d6a579182015b8281111562000d6957825182559160200191906001019062000d4c565b5b50905062000d79919062000eec565b5090565b82805482825590600052602060002090810192821562000dd1579160200282015b8281111562000dd057825182908051906020019062000dbf92919062000cf6565b509160200191906001019062000d9e565b5b50905062000de0919062000f14565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1062000e2757805160ff191683800117855562000e58565b8280016001018555821562000e58579182015b8281111562000e5757825182559160200191906001019062000e3a565b5b50905062000e67919062000eec565b5090565b82805482825590600052602060002090810192821562000ebf579160200282015b8281111562000ebe57825182908051906020019062000ead92919062000cf6565b509160200191906001019062000e8c565b5b50905062000ece919062000f14565b5090565b604080519081016040528060008152602001600081525090565b62000f1191905b8082111562000f0d57600081600090555060010162000ef3565b5090565b90565b62000f4291905b8082111562000f3e576000818162000f34919062000f45565b5060010162000f1b565b5090565b90565b50805460018160011615610100020316600290046000825580601f1062000f6d575062000f8e565b601f01602090049060005260206000209081019062000f8d919062000eec565b5b50565b600062000f9f82516200106c565b905092915050565b60006020828403121562000fba57600080fd5b600062000fca8482850162000f91565b91505092915050565b600062000fe08262001061565b80845262000ff681602086016020860162001076565b6200100181620010ac","565b602085010191505092915050565b600060608201905081810360008301526200102b818662000fd3565b9050818103602083015262001041818562000fd3565b9050818103604083015262001057818462000fd3565b9050949350505050565b600081519050919050565b6000819050919050565b60005b838110156200109657808201518184015260208101905062001079565b83811115620010a6576000848401525b50505050565b6000601f19601f8301169050919050565b61307880620010cd6000396000f3fe608060405234801561001057600080fd5b5060043610610074576000357c0100000000000000000000000000000000000000000000000000000000900480635d09ceb814610079578063915ab75514610095578063a14c87ca146100b1578063af7d5eb5146100cd578063dcfefd71146100fd575b600080fd5b610093600480360361008e91908101906124c7565b61012e565b005b6100af60048036036100aa91908101906124c7565b6101ef565b005b6100cb60048036036100c69190810190612445565b610390565b005b6100e760048036036100e29190810190612445565b6103f1565b6040516100f49190612763565b60405180910390f35b61011760048036036101129190810190612445565b610408565b60405161012592919061277e565b60405180910390f35b6000606061013b8461042a565b9150915060008214151515610185576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017c906129b5565b60405180910390fd5b606060016040519080825280602002602001820160405280156101bc57816020015b60608152602001906001900390816101a75790505b509050838160008151811015156101cf57fe5b906020019060200201819052506101e7858683610677565b505050505050565b600060606101fc8461042a565b91509150600082141515610245576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023c906129d5565b60405180910390fd5b6060600160405190808252806020026020018201604052801561027c57816020015b60608152602001906001900390816102675790505b5090508381600081518110151561028f57fe5b90602001906020020181905250610388856006805480602002602001604051908101604052809291908181526020016000905b8282101561037e578382906000526020600020018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561036a5780601f1061033f5761010080835404028352916020019161036a565b820191906000526020600020905b81548152906001019060200180831161034d57829003601f168201915b5050505050815260200190600101906102c2565b5050505083610aca565b505050505050565b600061039b8261042a565b5090506000811415156103e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103da90612995565b60405180910390fd5b6103ec82611032565b505050565b6000806103fd836111bd565b905080915050919050565b60006060600060606104198561042a565b915091508181935093505050915091565b6000606060006104386113ed565b905060008173ffffffffffffffffffffffffffffffffffffffff1663e8434e39868473ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156104bb57600080fd5b505afa1580156104cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506104f39190810190612378565b6040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161052c929190612830565b60206040518083038186803b15801561054457600080fd5b505afa158015610558573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061057c91908101906123a1565b905061066c6000600301805480602002602001604051908101604052809291908181526020016000905b82821015610662578382906000526020600020018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561064e5780601f106106235761010080835404028352916020019161064e565b820191906000526020600020905b81548152906001019060200180831161063157829003601f168201915b5050505050815260200190600101906105a6565b50505050826114a3565b935093505050915091565b6000600160006003018054905003825114151561069357600080fd5b60008060606106a28787611a7c565b8092508193505050817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1415610a5e5760006106dc6113ed565b905060008173ffffffffffffffffffffffffffffffffffffffff166313db93466040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561074257600080fd5b505afa158015610756573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061077a91908101906123ca565b90508073ffffffffffffffffffffffffffffffffffffffff1663e942b51660006001018b6040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016107d792919061295e565b600060405180830381600087803b1580156107f157600080fd5b505af1158015610805573d6000803e3d6000fd5b505050508073ffffffffffffffffffffffffffffffffffffffff1663e942b51660006002018a6040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161086492919061295e565b600060405180830381600087803b15801561087e57600080fd5b505af1158015610892573d6000803e3d6000fd5b505050506000600190505b600060030180549050811015610978578173ffffffffffffffffffffffffffffffffffffffff1663e942b5166000600301838154811015156108db57fe5b906000526020600020018a600185038151811015156108f657fe5b906020019060200201516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610939929190612927565b600060405180830381600087803b15801561095357600080fd5b505af1158015610967573d6000803e3d6000fd5b50505050808060010191505061089d565b508173ffffffffffffffffffffffffffffffffffffffff166331afac368a836040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016109d0929190612860565b602060405180830381600087803b1580156109ea57600080fd5b505af11580156109fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a22919081019061241c565b60011415610a335760009450610a57565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe94505b5050610a82565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92505b7f9994ba29bf7f93f869f42bc2c06a947ca883df73b7c6eb95482a190d7e437cd2838888604051610ab5939291906127ae565b60405180910390a18293505050509392505050565b600081518351141515610b12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b09906129f5565b60405180910390fd5b6000610b1c6113ed565b905060008173ffffffffffffffffffffffffffffffffffffffff1663e8434e39878473ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015610b9f57600080fd5b505afa158015610bb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610bd79190810190612378565b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610c10929190612830565b60206040518083038186803b158015610c2857600080fd5b505afa158015610c3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c6091908101906123a1565b905060008173ffffffffffffffffffffffffffffffffffffffff1663949d225d6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015610cc657600080fd5b505afa158015610cda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610cfe919081019061241c565b1415610d2e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9250505061102b565b60008173ffffffffffffffffffffffffffffffffffffffff1663846719e060006040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610d8691906127f3565b60206040518083038186803b158015610d9e57600080fd5b505afa158015610db2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610dd691908101906123ca565b905060008090505b8651811015610eab578173ffffffffffffffffffffffffffffffffffffffff1663e942b5168883815181101515610e1157fe5b906020019060200201518884815181101515610e2957fe5b906020019060200201516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610e6c9291906128ce565b600060405180830381600087803b158015610e8657600080fd5b505af1158015610e9a573d6000803e3d6000fd5b505050508080600101915050610dde565b5060018373ffffffffffffffffffffffffffffffffffffffff1663bf2b70a189848773ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015610f2e57600080fd5b505afa15","8015610f42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f669190810190612378565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610fa093929190612890565b602060405180830381600087803b158015610fba57600080fd5b505af1158015610fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ff2919081019061241c565b1415611004576000935050505061102b565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe93505050505b9392505050565b60008061103d6113ed565b905060018173ffffffffffffffffffffffffffffffffffffffff166328bb2117858473ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156110c057600080fd5b505afa1580156110d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110f89190810190612378565b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401611131929190612830565b602060405180830381600087803b15801561114b57600080fd5b505af115801561115f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611183919081019061241c565b14156111935760009150506111b8565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9150505b919050565b6000806111c86113ed565b905060008173ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561122e57600080fd5b505afa158015611242573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506112669190810190612378565b905060008273ffffffffffffffffffffffffffffffffffffffff1663e8434e3986846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016112c1929190612830565b60206040518083038186803b1580156112d957600080fd5b505afa1580156112ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061131191908101906123a1565b905060008173ffffffffffffffffffffffffffffffffffffffff1663949d225d6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561137757600080fd5b505afa15801561138b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506113af919081019061241c565b14156113e0577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff93505050506113e8565b600093505050505b919050565b60008061100190508073ffffffffffffffffffffffffffffffffffffffff1663f23f63c9600080016040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161144d9190612905565b60206040518083038186803b15801561146557600080fd5b505afa158015611479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061149d91908101906123f3565b91505090565b60006060808373ffffffffffffffffffffffffffffffffffffffff1663949d225d6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561150a57600080fd5b505afa15801561151e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611542919081019061241c565b60001415611579577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff818191509250925050611a75565b6040805190810160405280600181526020017f5b00000000000000000000000000000000000000000000000000000000000000815250905060008090505b8473ffffffffffffffffffffffffffffffffffffffff1663949d225d6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561161957600080fd5b505afa15801561162d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611651919081019061241c565b811015611a27576060611708878773ffffffffffffffffffffffffffffffffffffffff1663846719e0856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016116b39190612763565b60206040518083038186803b1580156116cb57600080fd5b505afa1580156116df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061170391908101906123ca565b611d5c565b905060008090505b81518110156119315760008114156117b3576117b0846040805190810160405280600a81526020017f7b22696e646578223a220000000000000000000000000000000000000000000081525084600081518110151561176b57fe5b906020019060200201516040805190810160405280600381526020017f222c7b0000000000000000000000000000000000000000000000000000000000815250611e9a565b93505b61188e846040805190810160405280600181526020017f22000000000000000000000000000000000000000000000000000000000000008152508a848151811015156117fb57fe5b906020019060200201516040805190810160405280600381526020017f223a220000000000000000000000000000000000000000000000000000000000815250868681518110151561184957fe5b906020019060200201516040805190810160405280600181526020017f2200000000000000000000000000000000000000000000000000000000000000815250611f5d565b935060018251038114156118e2576118db846040805190810160405280600281526020017f7d7d00000000000000000000000000000000000000000000000000000000000081525061205c565b9350611924565b611921846040805190810160405280600181526020017f2c0000000000000000000000000000000000000000000000000000000000000081525061205c565b93505b8080600101915050611710565b5060018673ffffffffffffffffffffffffffffffffffffffff1663949d225d6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561199657600080fd5b505afa1580156119aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506119ce919081019061241c565b0382141515611a1957611a16836040805190810160405280600181526020017f2c0000000000000000000000000000000000000000000000000000000000000081525061205c565b92505b5080806001019150506115b7565b50611a67816040805190810160405280600181526020017f5d0000000000000000000000000000000000000000000000000000000000000081525061205c565b905060008181915092509250505b9250929050565b600060606000611a8a6113ed565b905060008173ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015611af057600080fd5b505afa158015611b04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b289190810190612378565b90508073ffffffffffffffffffffffffffffffffffffffff1663cd30a1d16000600201876040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401611b8592919061295e565b60006040518083038186803b158015611b9d57600080fd5b505afa158015611bb1573d6000803e3d6000fd5b5050505060008273ffffffffffffffffffffffffffffffffffffffff1663e8434e3988846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401611c0e929190612830565b60206040518083038186803b158015611c2657600080fd5b505afa158015611c3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611c5e91908101906123a1565b9050611d4e6000600301805480602002602001604051908101604052809291908181526020016000905b82821015611d44578382906000526020600020018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611d305780601f10611d0557610100808354040283529160200191611d30565b820191906000526020600020905b815481529060010190602001808311611d1357829003601f168201915b505050505081526020019060010190611c88565b50505050826114a3565b945094505050509250929050565b6060808351604051908082528060200260200182016040528015611d9457816020015b6060815260200190600190039081611d7f5790505b50905060008090505b8451811015611e8f578373ffffffffffffffffffffffffffffffffffffffff16639c981fcb8683815181101515611dd057fe5b906020019060200201516040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401611e12919061280e565b60006040518083038186803b158015611e2a57600080fd5b505afa158015611e3e573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250611e679190810190612486565b8282815181101515611e7557fe5b906020019060200201819052508080600101915050611d9d565b508091505092915050565b6060806004604051908082528060200260200182016040528015611ed257816020015b6060815260200190600190039081611ebd5790505b50905085816000815181101515611ee557fe5b9060200190602002018190525084816001815181101515611f0257fe5b9060200190602002018190525083816002815181101515611f1f57fe5b90602001906020020181905250828160038151","81101515611f3c57fe5b90602001906020020181905250611f52816120e3565b915050949350505050565b6060806006604051908082528060200260200182016040528015611f9557816020015b6060815260200190600190039081611f805790505b50905087816000815181101515611fa857fe5b9060200190602002018190525086816001815181101515611fc557fe5b9060200190602002018190525085816002815181101515611fe257fe5b9060200190602002018190525084816003815181101515611fff57fe5b906020019060200201819052508381600481518110151561201c57fe5b906020019060200201819052508281600581518110151561203957fe5b9060200190602002018190525061204f816120e3565b9150509695505050505050565b606080600260405190808252806020026020018201604052801561209457816020015b606081526020019060019003908161207f5790505b509050838160008151811015156120a757fe5b90602001906020020181905250828160018151811015156120c457fe5b906020019060200201819052506120da816120e3565b91505092915050565b6060600080905060008090505b835181101561212357838181518110151561210757fe5b90602001906020020151518201915080806001019150506120f0565b506060816040519080825280601f01601f1916602001820160405280156121595781602001600182028038833980820191505090505b5090506060819050600080905060008090505b865181101561225b576060878281518110151561218557fe5b90602001906020020151905060008090505b815181101561224c5781818151811015156121ae57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002858581518110151561220757fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535083806001019450508080600101915050612197565b5050808060010191505061216c565b5081945050505050919050565b60006122748251612ad2565b905092915050565b60006122888251612ae4565b905092915050565b600061229c8251612af6565b905092915050565b60006122b08251612b08565b905092915050565b60006122c48251612b1a565b905092915050565b600082601f83011215156122df57600080fd5b81356122f26122ed82612a42565b612a15565b9150808252602083016020830185838301111561230e57600080fd5b612319838284612b7e565b50505092915050565b600082601f830112151561233557600080fd5b815161234861234382612a42565b612a15565b9150808252602083016020830185838301111561236457600080fd5b61236f838284612b8d565b50505092915050565b60006020828403121561238a57600080fd5b600061239884828501612268565b91505092915050565b6000602082840312156123b357600080fd5b60006123c18482850161227c565b91505092915050565b6000602082840312156123dc57600080fd5b60006123ea84828501612290565b91505092915050565b60006020828403121561240557600080fd5b6000612413848285016122a4565b91505092915050565b60006020828403121561242e57600080fd5b600061243c848285016122b8565b91505092915050565b60006020828403121561245757600080fd5b600082013567ffffffffffffffff81111561247157600080fd5b61247d848285016122cc565b91505092915050565b60006020828403121561249857600080fd5b600082015167ffffffffffffffff8111156124b257600080fd5b6124be84828501612322565b91505092915050565b600080604083850312156124da57600080fd5b600083013567ffffffffffffffff8111156124f457600080fd5b612500858286016122cc565b925050602083013567ffffffffffffffff81111561251d57600080fd5b612529858286016122cc565b9150509250929050565b61253c81612b24565b82525050565b61254b81612b48565b82525050565b61255a81612aa8565b82525050565b61256981612b6c565b82525050565b600061257a82612a8b565b80845261258e816020860160208601612b8d565b61259781612bc0565b602085010191505092915050565b60006125b082612a80565b8084526125c4816020860160208601612b8d565b6125cd81612bc0565b602085010191505092915050565b6000815460018116600081146125f8576001811461261857612659565b607f600283041680865260ff198316602087015260408601935050612659565b6002820480865260208601955061262e85612a6e565b60005b8281101561265057815481890152600182019150602081019050612631565b80880195505050505b505092915050565b6000600d82527f6b6579206e6f7420666f756e64000000000000000000000000000000000000006020830152604082019050919050565b6000600a82527f6b657920657869747321000000000000000000000000000000000000000000006020830152604082019050919050565b6000600e82527f6b6579206e6f74206578697473210000000000000000000000000000000000006020830152604082019050919050565b6000602482527f4669656c647320616e64206e657756616c756573206c656e677468206d69736d60208301527f61746368000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b60006020820190506127786000830184612551565b92915050565b60006040820190506127936000830185612551565b81810360208301526127a5818461256f565b90509392505050565b60006060820190506127c36000830186612551565b81810360208301526127d5818561256f565b905081810360408301526127e9818461256f565b9050949350505050565b60006020820190506128086000830184612560565b92915050565b6000602082019050818103600083015261282881846125a5565b905092915050565b6000604082019050818103600083015261284a818561256f565b90506128596020830184612533565b9392505050565b6000604082019050818103600083015261287a818561256f565b90506128896020830184612542565b9392505050565b600060608201905081810360008301526128aa818661256f565b90506128b96020830185612542565b6128c66040830184612533565b949350505050565b600060408201905081810360008301526128e881856125a5565b905081810360208301526128fc81846125a5565b90509392505050565b6000602082019050818103600083015261291f81846125db565b905092915050565b6000604082019050818103600083015261294181856125db565b9050818103602083015261295581846125a5565b90509392505050565b6000604082019050818103600083015261297881856125db565b9050818103602083015261298c818461256f565b90509392505050565b600060208201905081810360008301526129ae81612661565b9050919050565b600060208201905081810360008301526129ce81612698565b9050919050565b600060208201905081810360008301526129ee816126cf565b9050919050565b60006020820190508181036000830152612a0e81612706565b9050919050565b6000604051905081810181811067ffffffffffffffff82111715612a3857600080fd5b8060405250919050565b600067ffffffffffffffff821115612a5957600080fd5b601f19601f8301169050602081019050919050565b60008160005260206000209050919050565b600081519050919050565b600081519050919050565b6000612aa182612ab2565b9050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612add82612a96565b9050919050565b6000612aef82612a96565b9050919050565b6000612b0182612a96565b9050919050565b6000612b1382612a96565b9050919050565b6000819050919050565b6000612b2f82612b36565b9050919050565b6000612b4182612ab2565b9050919050565b6000612b5382612b5a565b9050919050565b6000612b6582612ab2565b9050919050565b6000612b7782612aa8565b9050919050565b82818337600083830152505050565b60005b83811015612bab578082015181840152602081019050612b90565b83811115612bba576000848401525b50505050565b6000601f19601f8301169050919050565b612bd9613024565b600060208301905060408051908101604052808451815260200182815250915050919050565b6060600082511415612c235760206040519081016040528060008152509050612d5d565b60006001835103846000015102905060008090505b8351811015612c6e578381815181101515612c4f57fe5b9060200190602002015160000151820191508080600101915050612c38565b506060816040519080825280601f01601f191660200182016040528015612ca45781602001600182028038833980820191505090505b509050600060208201905060008090505b8551811015612d5557612cff828783815181101515612cd057fe5b90602001906020020151602001518884815181101515612cec57fe5b9060200190602002015160000151612e56565b8581815181101515612d0d57fe5b9060200190602002015160000151820191506001865103811015612d4857612d3e8288602001518960000151612e56565b8660000151820191505b8080600101915050612cb5565b508193505050505b92915050565b6000808260000151612d878560000151866020015186600001518760200151612ea1565b0190505b836000015184602001510181111515612dd35781806001019250508260000151612dcb856020015183038660000151038386600001518760200151612ea1565b019050612d8b565b5092915050565b612de2613024565b612ded838383612f86565b5092915050565b60608082600001516040519080825280601f01601f191660200182016040528015612e2e5781602001600182028038833980820191505090505b5090506000602082019050612e4c8185602001518660000151612e56565b8192505050919050565b5b602081101515612e7c5781518352602083019250602082019150602081039050612e57565b60006001826020036101000a0390508019835116818551168181178652505050505050565b60008084905060008685111515612f7657602085111515612f2e57600060018660200360080260020a0319600102905060008186511690506000878a8a0103905060008386511690505b8281141515612f20578186101515612f0d578a8a019650505050505050612f7e565b8580600101965050838651169050612eeb565b859650505050505050612f7e565b60008585","209050600091505b85880382111515612f74576000868420905080821415612f605783945050505050612f7e565b600184019350508180600101925050612f3a565b505b868601925050505b949350505050565b612f8e613024565b6000612fac8560000151866020015186600001518760200151612ea1565b90508460200151836020018181525050846020015181038360000181815250508460000151856020015101811415612fee576000856000018181525050613019565b8360000151836000015101856000018181510391508181525050836000015181018560200181815250505b829150509392505050565b60408051908101604052806000815260200160008152509056fea265627a7a7230582000d2fbf8bea0eee7b8aaca70f4dababc76c8819b4563f98cd92749be35ea2cf96c6578706572696d656e74616cf50037"};

    public static final String BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", BINARY_ARRAY);

    public static final String[] SM_BINARY_ARRAY = {};

    public static final String SM_BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", SM_BINARY_ARRAY);

    public static final String[] ABI_ARRAY = {"[{\"constant\":false,\"inputs\":[{\"name\":\"key\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"}],\"name\":\"createMap\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"key\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"}],\"name\":\"updateMap\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"key\",\"type\":\"string\"}],\"name\":\"deleteMap\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"key\",\"type\":\"string\"}],\"name\":\"existMap\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"key\",\"type\":\"string\"}],\"name\":\"readMap\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"},{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"retCode\",\"type\":\"int256\"},{\"indexed\":false,\"name\":\"primaryKey\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"uniqueKey\",\"type\":\"string\"}],\"name\":\"AddEvent\",\"type\":\"event\"}]"};

    public static final String ABI = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", ABI_ARRAY);

    public static final String FUNC_CREATEMAP = "createMap";

    public static final String FUNC_UPDATEMAP = "updateMap";

    public static final String FUNC_DELETEMAP = "deleteMap";

    public static final String FUNC_EXISTMAP = "existMap";

    public static final String FUNC_READMAP = "readMap";

    public static final Event ADDEVENT_EVENT = new Event("AddEvent",
            Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
    ;

    protected MapStorage(String contractAddress, Client client, CryptoKeyPair credential) {
        super(getBinary(client.getCryptoSuite()), contractAddress, client, credential);
    }

    public static String getBinary(CryptoSuite cryptoSuite) {
        return (cryptoSuite.getCryptoTypeConfig() == CryptoType.ECDSA_TYPE ? BINARY : SM_BINARY);
    }

    public TransactionReceipt createMap(String key, String value) {
        final Function function = new Function(
                FUNC_CREATEMAP,
                Arrays.<Type>asList(new Utf8String(key),
                new Utf8String(value)),
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void createMap(String key, String value, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_CREATEMAP,
                Arrays.<Type>asList(new Utf8String(key),
                new Utf8String(value)),
                Collections.<TypeReference<?>>emptyList());
          asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForCreateMap(String key, String value) {
        final Function function = new Function(
                FUNC_CREATEMAP,
                Arrays.<Type>asList(new Utf8String(key),
                new Utf8String(value)),
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<String, String> getCreateMapInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_CREATEMAP,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<String, String>(

                (String) results.get(0).getValue(),
                (String) results.get(1).getValue()
                );
    }

    public TransactionReceipt updateMap(String key, String value) {
        final Function function = new Function(
                FUNC_UPDATEMAP,
                Arrays.<Type>asList(new Utf8String(key),
                new Utf8String(value)),
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void updateMap(String key, String value, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_UPDATEMAP,
                Arrays.<Type>asList(new Utf8String(key),
                new Utf8String(value)),
                Collections.<TypeReference<?>>emptyList());
          asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForUpdateMap(String key, String value) {
        final Function function = new Function(
                FUNC_UPDATEMAP,
                Arrays.<Type>asList(new Utf8String(key),
                new Utf8String(value)),
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<String, String> getUpdateMapInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_UPDATEMAP,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<String, String>(

                (String) results.get(0).getValue(),
                (String) results.get(1).getValue()
                );
    }

    public TransactionReceipt deleteMap(String key) {
        final Function function = new Function(
                FUNC_DELETEMAP,
                Arrays.<Type>asList(new Utf8String(key)),
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void deleteMap(String key, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_DELETEMAP,
                Arrays.<Type>asList(new Utf8String(key)),
                Collections.<TypeReference<?>>emptyList());
          asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForDeleteMap(String key) {
        final Function function = new Function(
                FUNC_DELETEMAP,
                Arrays.<Type>asList(new Utf8String(key)),
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple1<String> getDeleteMapInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_DELETEMAP,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<String>(

                (String) results.get(0).getValue()
                );
    }

    public BigInteger existMap(String key) throws ContractException {
        final Function function = new Function(FUNC_EXISTMAP,
                Arrays.<Type>asList(new Utf8String(key)),
                Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public Tuple2<BigInteger, String> readMap(String key) throws ContractException {
        final Function function = new Function(FUNC_READMAP,
                Arrays.<Type>asList(new Utf8String(key)),
                Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = executeCallWithMultipleValueReturn(function);
        return new Tuple2<BigInteger, String>(
                (BigInteger) results.get(0).getValue(),
                (String) results.get(1).getValue());
    }

    public List<AddEventEventResponse> getAddEventEvents(TransactionReceipt transactionReceipt) {
        List<EventValuesWithLog> valueList = extractEventParametersWithLog(ADDEVENT_EVENT, transactionReceipt);
        ArrayList<AddEventEventResponse> responses = new ArrayList<AddEventEventResponse>(valueList.size());
        for (EventValuesWithLog eventValues : valueList) {
            AddEventEventResponse typedResponse = new AddEventEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.retCode = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            typedResponse.primaryKey = (String) eventValues.getNonIndexedValues().get(1).getValue();
            typedResponse.uniqueKey = (String) eventValues.getNonIndexedValues().get(2).getValue();
            responses.add(typedResponse);
        }
        return responses;
    }

    public void subscribeAddEventEvent(String fromBlock, String toBlock, List<String> otherTopics, EventCallback callback) {
        String topic0 = eventEncoder.encode(ADDEVENT_EVENT);
        subscribeEvent(ABI,BINARY,topic0,fromBlock,toBlock,otherTopics,callback);
    }

    public void subscribeAddEventEvent(EventCallback callback) {
        String topic0 = eventEncoder.encode(ADDEVENT_EVENT);
        subscribeEvent(ABI,BINARY,topic0,callback);
    }

    public static MapStorage load(String contractAddress, Client client, CryptoKeyPair credential) {
        return new MapStorage(contractAddress, client, credential);
    }

    public static MapStorage deploy(Client client, CryptoKeyPair credential) throws ContractException {
        return deploy(MapStorage.class, client, credential, getBinary(client.getCryptoSuite()), "");
    }

    public static class AddEventEventResponse {
        public TransactionReceipt.Logs log;

        public BigInteger retCode;

        public String primaryKey;

        public String uniqueKey;
    }
}
